//
//  CategoryDatabase.h
//  QuizMaster
//
//  Created by Jeppe Nielsen on 3/17/15.
//  Copyright (c) 2015 Jeppe Nielsen. All rights reserved.
//

#pragma once

#include <string>
#include "Category.hpp"
#include <map>
class QuestionDatabase;

namespace minijson {
    class value;
}

class CategoryDatabase {
public:
    typedef std::map<int, Category> Categories;
    const Categories& GetCategories();
    void UpdateFromJSON(std::string json);
    Category* GetCategory(int index);
    
    void UpdateFromQuestions(QuestionDatabase* database);
    
private:
    void ParseJson(minijson::value& value);
    Categories categories;
};